<?php
defined ( 'BASEPATH' ) or exit ( 'No direct script access allowed' );
class Message_model extends MY_Model {
	public function __construct() {
		parent::__construct ( 'message' );
	}
	/**
	 * 创建数据表
	 */
	public function create() {
		$this->drop ();
		$sql = "CREATE TABLE `message` (
  				`mid` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT '众创项目id',
  				`suid` int(10) unsigned NOT NULL COMMENT '发起者用户ID',
				`ruid` int(10) unsigned NOT NULL COMMENT '接收者用户ID',
  				`content` varchar(200) NOT NULL COMMENT '短信内容',
  				`sendtime` int(10) unsigned NOT NULL COMMENT '短信发送时间',
				`lookStatus` tinyint(1) unsigned NOT NULL DEFAULT '0' COMMENT '短信浏览状态（0：未浏览；1：已浏览）',
  				`status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '短信状态（0：删除；1：正常）',
  				PRIMARY KEY (`mid`)
				) ENGINE=InnoDB AUTO_INCREMENT=1000 DEFAULT CHARSET=utf8 COMMENT='信息表';";
		$re = $this->db->simple_query ( $sql );
	}
	/**
	 * 删除数据表
	 */
	public function drop() {
		$sql = 'DROP TABLE IF EXISTS `project`;';
		$re = $this->db->simple_query ( $sql );
		return $re;
	}
}